<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>日志管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
	    	return false;
	    }
	</script>
</head>
<body>
	<div class="box-wrapper">
		<div class="box box-first">
			<ul class="nav nav-tabs">
				<li class="active"><a href="${ctx}/sys/log/">日志列表</a></li>
			</ul>
			<div class="box-main">
				<form:form id="searchForm" action="${ctx}/sys/log/" method="post" class="breadcrumb form-search nui-form">
				<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
				<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
				<div class="log-form">
					<label>操作菜单：</label><input id="title" name="title" type="text" maxlength="50" class="input-mini form-control" value="${log.title}"/>
					<label>用户ID：</label><input id="createBy.id" name="createBy.id" type="text" maxlength="50" class="input-mini form-control" value="${log.createBy.id}"/>
					<label>URI：</label><input id="requestUri" name="requestUri" type="text" maxlength="50" class="input-mini form-control" value="${log.requestUri}"/>
				</div>
				<div class="log-form time-from">
					<label>日期范围：</label>
					<div class="form-group">
						<div class="input-group date form_date date-input" data-date="" data-date-format="yyyy-dd-MM" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
							<input id="beginDate" name="beginDate" type="text"  class="datepicker-input form-control" value="<fmt:formatDate value="${log.beginDate}" pattern="yyyy-MM-dd"/>">
							<span class="input-group-addon"><i class="fa fa-calendar icon-th"></i></span>
						</div>
					</div>
					<span class="input-split">--</span>
					<div class="form-group" style="">
						<div class="input-group date form_date date-input" data-date="" data-date-format="yyyy-dd-MM" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
							<input id="endDate" name="endDate" type="text"  class="datepicker-input form-control"
								   value="<fmt:formatDate value="${log.endDate}" pattern="yyyy-MM-dd"/>">
							<span class="input-group-addon"><i class="fa fa-calendar icon-th"></i></span>
						</div>
					</div>
					<label for="exception" class="anomaly-check"><input id="exception" name="exception" type="checkbox"${log.exception eq '1'?' checked':''} value="1"/ title="只查询异常信息"></label>
					&nbsp;&nbsp;&nbsp;
					<input id="btnSubmit" class="btn btn-primary log-search-btn" type="submit" value="查询"/>
				</div>
			</form:form>
			<sys:message content="${message}"/>
			<div class="p-a10">
				<table id="contentTable" class="table table-striped table-bordered table-condensed">
					<thead><tr><th>操作菜单</th><th>操作用户</th><th>所在公司</th><th>所在部门</th><th>URI</th><th>提交方式</th><th>操作者IP</th><th>操作时间</th></thead>
					<tbody><%request.setAttribute("strEnter", "\n");request.setAttribute("strTab", "\t");%>
					<c:forEach items="${page.list}" var="log">
						<tr>
							<td>${log.title}</td>
							<td>${log.createBy.name}</td>
							<td>${log.createBy.company.name}</td>
							<td>${log.createBy.office.name}</td>
							<td><strong>${log.requestUri}</strong></td>
							<td>${log.method}</td>
							<td>${log.remoteAddr}</td>
							<td><fmt:formatDate value="${log.createDate}" type="both"/></td>
						</tr>
						<c:if test="${not empty log.exception}"><tr>
							<td colspan="8" style="word-wrap:break-word;word-break:break-all;">
			<%-- 					用户代理: ${log.userAgent}<br/> --%>
			<%-- 					提交参数: ${fns:escapeHtml(log.params)} <br/> --%>
								异常信息: <br/>
								${fn:replace(fn:replace(fns:escapeHtml(log.exception), strEnter, '<br/>'), strTab, '&nbsp; &nbsp; ')}</td>
						</tr></c:if>
					</c:forEach>
					</tbody>
				</table>
			</div>
			<%@ include file="/WEB-INF/views/include/pagination.jsp"%>
			<script>
				$(function(){
					/*时间插件*/
					$('.form_date').datetimepicker({
						language:  'zh-CN',
						weekStart: 1,
						todayBtn:  1,
						autoclose: 1,
						todayHighlight: 1,
						startView: 2,
						minView: 2,
						forceParse: 0,
						format: 'yyyy-mm-dd'
					});
				})
			</script>
			</div>
		</div>
	</div>
	
</body>
</html>